<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>016-操作class.html</title>
	<style>
		/**{
			margin: 0;
			padding: 0;
		}*/
		.box1{
			width: 100px;
			height: 100px;
			margin: 20px;
			border: 1px solid #aaa;
		}
		.box2{
			background-color: #fbf000;
		}
		.box3{
			background-color: #fb9660;
		}
	</style>
</head>
<body>
	<button id="btn"><切换></button>
	<div class="box1 box2">1</div>
	<div class="box1 box2">2</div>
</body>
<script src="js/jquery-1.12.4.js"></script>
<script>
	$(function(){
		var oBtn = document.getElementById('btn');
		oBtn.onclick = function(){
			$('div').toggleClass('box3');
		}
	})
</script>
</html>